/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
 * Copyright 2008-2010 Pelican Mapping
 * http://osgearth.org
 *
 * osgEarth is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
#ifndef OSGEARTH_DRIVER_FEATURE_LABEL_MODEL_OPTIONS
#define OSGEARTH_DRIVER_FEATURE_LABEL_MODEL_OPTIONS 1

#include <VBF_3DMap/VBF_Terrain/Common.h>
#include <VBF_3DMap/VBF_Features/VBF_SourceModelFeature.h>

namespace osgEarth { namespace Drivers
{
    using namespace osgEarth;
    using namespace osgEarth::Features;

    class FeatureLabelModelOptions : public FeatureModelSourceOptions // NO EXPORT; header only
    {
    public:
        CVBF_Optional<std::string>& url() { return _url; }
        const CVBF_Optional<std::string>& url() const { return _url; }

        CVBF_Optional<double>& heightOffset() { return _heightOffset; }
        const CVBF_Optional<double>& heightOffset() const { return _heightOffset; }

        CVBF_Optional<bool>& hideClutter() { return _hideClutter; }
        const CVBF_Optional<bool>& hideClutter() const { return _hideClutter; }

    public:
        FeatureLabelModelOptions( const ConfigOptions& opt =ConfigOptions() ) : FeatureModelSourceOptions( opt ),
            _heightOffset( 0.0 )
        {
            setDriver( "feature_label" );
            fromConfig( _conf );
        }

    public:
        Config getConfig() const {
            Config conf = FeatureModelSourceOptions::getConfig();
            conf.updateIfSet( "url", _url );
            conf.updateIfSet( "height_offset", _heightOffset );
            conf.updateIfSet( "hide_clutter", _hideClutter );
            return conf;
        }

    protected:
        void mergeConfig( const Config& conf ) {
            FeatureModelSourceOptions::mergeConfig( conf );
            fromConfig( conf );
        }

    private:
        void fromConfig( const Config& conf ) {
            conf.getIfSet( "url", _url );
            conf.getIfSet( "height_offset", _heightOffset );
            conf.getIfSet( "hide_clutter", _hideClutter );
        }

        CVBF_Optional<std::string> _url;
        CVBF_Optional<double> _heightOffset;
        CVBF_Optional<bool> _hideClutter;
    };

} } // namespace osgEarth::Drivers

#endif // OSGEARTH_DRIVER_FEATURE_GEOM_MODEL_OPTIONS

